home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / DDEML.H < prev    next >
C/C++ Source or Header  |  1993-11-23  |  16KB  |  458 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. *  ddeml.h -    DDEML API header file                                         *
  4. *                                                                             *
  5. *               Version 1.0                                                   *
  6. *                                                                             *
  7. *               Copyright (c) 1992, Microsoft Corp.  All rights reserved.     *
  8. *                                                                             *
  9. \*****************************************************************************/
  10. #ifndef _INC_DDEML
  11. #define _INC_DDEML
  12.  
  13. #ifndef RC_INVOKED
  14. #pragma pack(1)
  15. #endif  /* RC_INVOKED */
  16.  
  17. #ifdef __cplusplus
  18. extern "C" {                /* Assume C declarations for C++ */
  19. #endif /* __cplusplus */
  20.  
  21. #ifndef _INC_WINDOWS    /* If not included with 3.1 headers... */
  22. #define LPCSTR      LPSTR
  23. #define WINAPI      FAR PASCAL
  24. #define CALLBACK    FAR PASCAL
  25. #define UINT        WORD
  26. #define LPARAM      LONG
  27. #define WPARAM      WORD
  28. #define LRESULT     LONG
  29. #define HMODULE     HANDLE
  30. #define HINSTANCE   HANDLE
  31. #define HLOCAL      HANDLE
  32. #define HGLOBAL     HANDLE
  33. #endif  /* _INC_WINDOWS */
  34.  
  35. #ifndef DECLARE_HANDLE32
  36. #ifdef STRICT
  37. #define DECLARE_HANDLE32(name)  struct name##__ { int unused; }; \
  38.                                 typedef const struct name##__ _far* name
  39. #else   /* STRICT */
  40. #define DECLARE_HANDLE32(name)  typedef DWORD name
  41. #endif  /* !STRICT */
  42. #endif  /* !DECLARE_HANDLE32 */
  43.  
  44. #define EXPENTRY    WINAPI
  45.  
  46. /******** public types ********/
  47.  
  48. DECLARE_HANDLE32(HCONVLIST);
  49. DECLARE_HANDLE32(HCONV);
  50. DECLARE_HANDLE32(HSZ);
  51. DECLARE_HANDLE32(HDDEDATA);
  52.  
  53. /* the following structure is for use with XTYP_WILDCONNECT processing. */
  54.  
  55. typedef struct tagHSZPAIR
  56. {
  57.     HSZ hszSvc;
  58.     HSZ hszTopic;
  59. } HSZPAIR;
  60. typedef HSZPAIR FAR *PHSZPAIR;
  61.  
  62. /* The following structure is used by DdeConnect() and DdeConnectList() and
  63.    by XTYP_CONNECT and XTYP_WILDCONNECT callbacks. */
  64.  
  65. typedef struct tagCONVCONTEXT
  66. {
  67.     UINT        cb;             /* set to sizeof(CONVCONTEXT) */
  68.     UINT        wFlags;         /* none currently defined. */
  69.     UINT        wCountryID;     /* country code for topic/item strings used. */
  70.     int         iCodePage;      /* codepage used for topic/item strings. */
  71.     DWORD       dwLangID;       /* language ID for topic/item strings. */
  72.     DWORD       dwSecurity;     /* Private security code. */
  73. } CONVCONTEXT;
  74. typedef CONVCONTEXT FAR *PCONVCONTEXT;
  75.  
  76. /* The following structure is used by DdeQueryConvInfo(): */
  77.  
  78. typedef struct tagCONVINFO
  79. {
  80.     DWORD   cb;            /* sizeof(CONVINFO)  */
  81.     DWORD   hUser;         /* user specified field  */
  82.     HCONV   hConvPartner;  /* hConv on other end or 0 if non-ddemgr partner  */
  83.     HSZ     hszSvcPartner; /* app name of partner if obtainable  */
  84.     HSZ     hszServiceReq; /* AppName requested for connection  */
  85.     HSZ     hszTopic;      /* Topic name for conversation  */
  86.     HSZ     hszItem;       /* transaction item name or NULL if quiescent  */
  87.     UINT    wFmt;          /* transaction format or NULL if quiescent  */
  88.     UINT    wType;         /* XTYP_ for current transaction  */
  89.     UINT    wStatus;       /* ST_ constant for current conversation  */
  90.     UINT    wConvst;       /* XST_ constant for current transaction  */
  91.     UINT    wLastError;    /* last transaction error.  */
  92.     HCONVLIST hConvList;   /* parent hConvList if this conversation is in a list */
  93.     CONVCONTEXT ConvCtxt;  /* conversation context */
  94. } CONVINFO;
  95. typedef CONVINFO FAR *PCONVINFO;
  96.  
  97. /***** conversation states (usState) *****/
  98.  
  99. #define     XST_NULL              0  /* quiescent states */
  100. #define     XST_INCOMPLETE        1
  101. #define     XST_CONNECTED         2
  102. #define     XST_INIT1             3  /* mid-initiation states */
  103. #define     XST_INIT2             4
  104. #define     XST_REQSENT           5  /* active conversation states */
  105. #define     XST_DATARCVD          6
  106. #define     XST_POKESENT          7
  107. #define     XST_POKEACKRCVD       8
  108. #define     XST_EXECSENT          9
  109. #define     XST_EXECACKRCVD      10
  110. #define     XST_ADVSENT          11
  111. #define     XST_UNADVSENT        12
  112. #define     XST_ADVACKRCVD       13
  113. #define     XST_UNADVACKRCVD     14
  114. #define     XST_ADVDATASENT      15
  115. #define     XST_ADVDATAACKRCVD   16
  116.  
  117. /* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */
  118. #define     CADV_LATEACK         0xFFFF
  119.  
  120. /***** conversation status bits (fsStatus) *****/
  121.  
  122. #define     ST_CONNECTED        0x0001
  123. #define     ST_ADVISE           0x0002
  124. #define     ST_ISLOCAL          0x0004
  125. #define     ST_BLOCKED          0x0008
  126. #define     ST_CLIENT           0x0010
  127. #define     ST_TERMINATED       0x0020
  128. #define     ST_INLIST           0x0040
  129. #define     ST_BLOCKNEXT        0x0080
  130. #define     ST_ISSELF           0x0100
  131.  
  132. /* DDE constants for wStatus field */
  133.  
  134. #define DDE_FACK          0x8000
  135. #define DDE_FBUSY          0x4000
  136. #define DDE_FDEFERUPD        0x4000
  137. #define DDE_FACKREQ            0x8000
  138. #define DDE_FRELEASE          0x2000
  139. #define DDE_FREQUESTED        0x1000
  140. #define DDE_FACKRESERVED    0x3ff0
  141. #define DDE_FADVRESERVED    0x3fff
  142. #define DDE_FDATRESERVED    0x4fff
  143. #define DDE_FPOKRESERVED    0xdfff
  144. #define DDE_FAPPSTATUS        0x00ff
  145. #define DDE_FNOTPROCESSED   0x0000
  146.  
  147. /***** message filter hook types *****/
  148.  
  149. #define     MSGF_DDEMGR             0x8001
  150.  
  151. /***** codepage constants ****/
  152.  
  153. #define CP_WINANSI      1004    /* default codepage for windows & old DDE convs. */
  154.  
  155. /***** transaction types *****/
  156.  
  157. #define     XTYPF_NOBLOCK            0x0002  /* CBR_BLOCK will not work */
  158. #define     XTYPF_NODATA             0x0004  /* DDE_FDEFERUPD */
  159. #define     XTYPF_ACKREQ             0x0008  /* DDE_FACKREQ */
  160.  
  161. #define     XCLASS_MASK              0xFC00
  162. #define     XCLASS_BOOL              0x1000
  163. #define     XCLASS_DATA              0x2000
  164. #define     XCLASS_FLAGS             0x4000
  165. #define     XCLASS_NOTIFICATION      0x8000
  166.  
  167. #define     XTYP_ERROR              (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
  168. #define     XTYP_ADVDATA            (0x0010 | XCLASS_FLAGS         )
  169. #define     XTYP_ADVREQ             (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK )
  170. #define     XTYP_ADVSTART           (0x0030 | XCLASS_BOOL          )
  171. #define     XTYP_ADVSTOP            (0x0040 | XCLASS_NOTIFICATION)
  172. #define     XTYP_EXECUTE            (0x0050 | XCLASS_FLAGS         )
  173. #define     XTYP_CONNECT            (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
  174. #define     XTYP_CONNECT_CONFIRM    (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  175. #define     XTYP_XACT_COMPLETE      (0x0080 | XCLASS_NOTIFICATION  )
  176. #define     XTYP_POKE               (0x0090 | XCLASS_FLAGS         )
  177. #define     XTYP_REGISTER           (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  178. #define     XTYP_REQUEST            (0x00B0 | XCLASS_DATA          )
  179. #define     XTYP_DISCONNECT         (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  180. #define     XTYP_UNREGISTER         (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  181. #define     XTYP_WILDCONNECT        (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
  182.  
  183. #define     XTYP_MASK                0x00F0
  184. #define     XTYP_SHIFT               4  /* shift to turn XTYP_ into an index */
  185.  
  186. /***** Timeout constants *****/
  187.  
  188. #define     TIMEOUT_ASYNC           -1L
  189.  
  190. /***** Transaction ID constants *****/
  191.  
  192. #define     QID_SYNC                -1L
  193.  
  194. /****** public strings used in DDE ******/
  195.  
  196. #define SZDDESYS_TOPIC          "System"
  197. #define SZDDESYS_ITEM_TOPICS    "Topics"
  198. #define SZDDESYS_ITEM_SYSITEMS  "SysItems"
  199. #define SZDDESYS_ITEM_RTNMSG    "ReturnMessage"
  200. #define SZDDESYS_ITEM_STATUS    "Status"
  201. #define SZDDESYS_ITEM_FORMATS   "Formats"
  202. #define SZDDESYS_ITEM_HELP      "Help"
  203. #define SZDDE_ITEM_ITEMLIST     "TopicItemList"
  204.  
  205.  
  206. /****** API entry points ******/
  207.  
  208. typedef HDDEDATA CALLBACK FNCALLBACK(UINT wType, UINT wFmt, HCONV hConv,
  209.         HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2);
  210. typedef FNCALLBACK *PFNCALLBACK;
  211.  
  212. #define     CBR_BLOCK                0xffffffffL
  213.  
  214. /* DLL registration functions */
  215.  
  216. UINT    WINAPI DdeInitialize(DWORD FAR* pidInst, PFNCALLBACK pfnCallback,
  217.                 DWORD afCmd, DWORD ulRes);
  218.  
  219. /*
  220.  * Callback filter flags for use with standard apps.
  221.  */
  222.  
  223. #define     CBF_FAIL_SELFCONNECTIONS     0x00001000
  224. #define     CBF_FAIL_CONNECTIONS         0x00002000
  225. #define     CBF_FAIL_ADVISES             0x00004000
  226. #define     CBF_FAIL_EXECUTES            0x00008000
  227. #define     CBF_FAIL_POKES               0x00010000
  228. #define     CBF_FAIL_REQUESTS            0x00020000
  229. #define     CBF_FAIL_ALLSVRXACTIONS      0x0003f000
  230.  
  231. #define     CBF_SKIP_CONNECT_CONFIRMS    0x00040000
  232. #define     CBF_SKIP_REGISTRATIONS       0x00080000
  233. #define     CBF_SKIP_UNREGISTRATIONS     0x00100000
  234. #define     CBF_SKIP_DISCONNECTS         0x00200000
  235. #define     CBF_SKIP_ALLNOTIFICATIONS    0x003c0000
  236.  
  237. /*
  238.  * Application command flags
  239.  */
  240. #define     APPCMD_CLIENTONLY            0x00000010L
  241. #define     APPCMD_FILTERINITS           0x00000020L
  242. #define     APPCMD_MASK                  0x00000FF0L
  243.  
  244. /*
  245.  * Application classification flags
  246.  */
  247. #define     APPCLASS_STANDARD            0x00000000L
  248. #define     APPCLASS_MASK                0x0000000FL
  249.  
  250.  
  251. BOOL    WINAPI DdeUninitialize(DWORD idInst);
  252.  
  253. /* conversation enumeration functions */
  254.  
  255. HCONVLIST WINAPI DdeConnectList(DWORD idInst, HSZ hszService, HSZ hszTopic,
  256.             HCONVLIST hConvList, CONVCONTEXT FAR* pCC);
  257. HCONV   WINAPI DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev);
  258. BOOL    WINAPI DdeDisconnectList(HCONVLIST hConvList);
  259.  
  260. /* conversation control functions */
  261.  
  262. HCONV   WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
  263.             CONVCONTEXT FAR* pCC);
  264. BOOL    WINAPI DdeDisconnect(HCONV hConv);
  265. HCONV   WINAPI DdeReconnect(HCONV hConv);
  266.  
  267. UINT    WINAPI DdeQueryConvInfo(HCONV hConv, DWORD idTransaction, CONVINFO FAR* pConvInfo);
  268. BOOL    WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser);
  269.  
  270. BOOL    WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction);
  271.  
  272.  
  273. /* app server interface functions */
  274.  
  275. BOOL    WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem);
  276. BOOL    WINAPI DdeEnableCallback(DWORD idInst, HCONV hConv, UINT wCmd);
  277.  
  278. #define EC_ENABLEALL            0
  279. #define EC_ENABLEONE            ST_BLOCKNEXT
  280. #define EC_DISABLE              ST_BLOCKED
  281. #define EC_QUERYWAITING         2
  282.  
  283. HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd);
  284.  
  285. #define DNS_REGISTER        0x0001
  286. #define DNS_UNREGISTER      0x0002
  287. #define DNS_FILTERON        0x0004
  288. #define DNS_FILTEROFF       0x0008
  289.  
  290. /* app client interface functions */
  291.  
  292. HDDEDATA WINAPI DdeClientTransaction(void FAR* pData, DWORD cbData,
  293.         HCONV hConv, HSZ hszItem, UINT wFmt, UINT wType,
  294.         DWORD dwTimeout, DWORD FAR* pdwResult);
  295.  
  296. /* data transfer functions */
  297.  
  298. HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, void FAR* pSrc, DWORD cb,
  299.             DWORD cbOff, HSZ hszItem, UINT wFmt, UINT afCmd);
  300. HDDEDATA WINAPI DdeAddData(HDDEDATA hData, void FAR* pSrc, DWORD cb, DWORD cbOff);
  301. DWORD   WINAPI DdeGetData(HDDEDATA hData, void FAR* pDst, DWORD cbMax, DWORD cbOff);
  302. BYTE FAR* WINAPI DdeAccessData(HDDEDATA hData, DWORD FAR* pcbDataSize);
  303. BOOL    WINAPI DdeUnaccessData(HDDEDATA hData);
  304. BOOL    WINAPI DdeFreeDataHandle(HDDEDATA hData);
  305.  
  306. #define     HDATA_APPOWNED          0x0001
  307.  
  308.  
  309.  
  310. UINT WINAPI DdeGetLastError(DWORD idInst);
  311.  
  312. #define     DMLERR_NO_ERROR                    0       /* must be 0 */
  313.  
  314. #define     DMLERR_FIRST                       0x4000
  315.  
  316. #define     DMLERR_ADVACKTIMEOUT               0x4000
  317. #define     DMLERR_BUSY                        0x4001
  318. #define     DMLERR_DATAACKTIMEOUT              0x4002
  319. #define     DMLERR_DLL_NOT_INITIALIZED         0x4003
  320. #define     DMLERR_DLL_USAGE                   0x4004
  321. #define     DMLERR_EXECACKTIMEOUT              0x4005
  322. #define     DMLERR_INVALIDPARAMETER            0x4006
  323. #define     DMLERR_LOW_MEMORY                  0x4007
  324. #define     DMLERR_MEMORY_ERROR                0x4008
  325. #define     DMLERR_NOTPROCESSED                0x4009
  326. #define     DMLERR_NO_CONV_ESTABLISHED         0x400a
  327. #define     DMLERR_POKEACKTIMEOUT              0x400b
  328. #define     DMLERR_POSTMSG_FAILED              0x400c
  329. #define     DMLERR_REENTRANCY                  0x400d
  330. #define     DMLERR_SERVER_DIED                 0x400e
  331. #define     DMLERR_SYS_ERROR                   0x400f
  332. #define     DMLERR_UNADVACKTIMEOUT             0x4010
  333. #define     DMLERR_UNFOUND_QUEUE_ID            0x4011
  334.  
  335. #define     DMLERR_LAST                        0x4011
  336.  
  337. HSZ     WINAPI DdeCreateStringHandle(DWORD idInst, LPCSTR psz, int iCodePage);
  338. DWORD   WINAPI DdeQueryString(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, int iCodePage);
  339. BOOL    WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz);
  340. BOOL    WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz);
  341. int     WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2);
  342.  
  343.  
  344. #ifndef NODDEMLSPY
  345. /* */
  346. /* DDEML public debugging header file info */
  347. /* */
  348.  
  349. typedef struct tagMONMSGSTRUCT
  350. {
  351.     UINT    cb;
  352.     HWND    hwndTo;
  353.     DWORD   dwTime;
  354.     HANDLE  hTask;
  355.     UINT    wMsg;
  356.     WPARAM  wParam;
  357.     LPARAM  lParam;
  358. } MONMSGSTRUCT;
  359.  
  360. typedef struct tagMONCBSTRUCT
  361. {
  362.     UINT   cb;
  363.     WORD   wReserved;
  364.     DWORD  dwTime;
  365.     HANDLE hTask;
  366.     DWORD  dwRet;
  367.     UINT   wType;
  368.     UINT   wFmt;
  369.     HCONV  hConv;
  370.     HSZ    hsz1;
  371.     HSZ    hsz2;
  372.     HDDEDATA hData;
  373.     DWORD  dwData1;
  374.     DWORD  dwData2;
  375. } MONCBSTRUCT;
  376.  
  377. typedef struct tagMONHSZSTRUCT
  378. {
  379.     UINT   cb;
  380.     BOOL   fsAction;    /* MH_ value */
  381.     DWORD  dwTime;
  382.     HSZ    hsz;
  383.     HANDLE hTask;
  384.     WORD   wReserved;
  385.     char   str[1];
  386. } MONHSZSTRUCT;
  387.  
  388. #define MH_CREATE   1
  389. #define MH_KEEP     2
  390. #define MH_DELETE   3
  391. #define MH_CLEANUP  4
  392.  
  393.  
  394. typedef struct tagMONERRSTRUCT
  395. {
  396.     UINT    cb;
  397.     UINT    wLastError;
  398.     DWORD   dwTime;
  399.     HANDLE  hTask;
  400. } MONERRSTRUCT;
  401.  
  402. typedef struct tagMONLINKSTRUCT
  403. {
  404.     UINT    cb;
  405.     DWORD   dwTime;
  406.     HANDLE  hTask;
  407.     BOOL    fEstablished;
  408.     BOOL    fNoData;
  409.     HSZ     hszSvc;
  410.     HSZ     hszTopic;
  411.     HSZ     hszItem;
  412.     UINT    wFmt;
  413.     BOOL    fServer;
  414.     HCONV   hConvServer;
  415.     HCONV   hConvClient;
  416. } MONLINKSTRUCT;
  417.  
  418. typedef struct tagMONCONVSTRUCT
  419. {
  420.     UINT    cb;
  421.     BOOL    fConnect;
  422.     DWORD   dwTime;
  423.     HANDLE  hTask;
  424.     HSZ     hszSvc;
  425.     HSZ     hszTopic;
  426.     HCONV   hConvClient;
  427.     HCONV   hConvServer;
  428. } MONCONVSTRUCT;
  429.  
  430. #define     MAX_MONITORS            4
  431. #define     APPCLASS_MONITOR        0x00000001L
  432. #define     XTYP_MONITOR            (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  433.  
  434. /*
  435.  * Callback filter flags for use with MONITOR apps - 0 implies no monitor
  436.  * callbacks.
  437.  */
  438. #define     MF_HSZ_INFO                  0x01000000
  439. #define     MF_SENDMSGS                  0x02000000
  440. #define     MF_POSTMSGS                  0x04000000
  441. #define     MF_CALLBACKS                 0x08000000
  442. #define     MF_ERRORS                    0x10000000
  443. #define     MF_LINKS                     0x20000000
  444. #define     MF_CONV                      0x40000000
  445.  
  446. #define     MF_MASK                      0xFF000000
  447. #endif /* NODDEMLSPY */
  448.  
  449. #ifdef __cplusplus
  450. }
  451. #endif
  452.  
  453. #ifndef RC_INVOKED
  454. #pragma pack()
  455. #endif  /* RC_INVOKED */
  456.  
  457. #endif /* _INC_DDEML */
  458.